package com.ruoyi.web.controller.cpsp;/*
    @author neu.xiangwenjuan
    @create 2022/4/26
*/

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.cpsp.service.DepartmentService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

//import javax.xml.ws.Action;

@CrossOrigin
@RestController
@RequestMapping("/cpsp/department")
public class DepartmentController extends BaseController {

    @Autowired
    private DepartmentService departmentService;

    @ApiOperation("得到部门列表")
    @RequestMapping(value = "selectAllDepartment",method = RequestMethod.GET)
    private AjaxResult selectAllDepartment() {
        return AjaxResult.success(departmentService.selectAll());
    }

    @ApiOperation("根据部门id得到班组列表")
    @RequestMapping(value = "getTeamByDepart",method = RequestMethod.GET)
    private AjaxResult getTeamByDepart(String departmentId) {
        return AjaxResult.success(departmentService.findTeamGroupByDepart(departmentId));
    }

    @ApiOperation("根据部门id得到部门信息")
    @RequestMapping(value = "getDeptNameById",method = RequestMethod.GET)
    private AjaxResult getDeptNameById(String departmentId) {
        return AjaxResult.success(departmentService.selectByDepartmentId(departmentId));
    }
}
